package org.example.Handler;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.SimpleChannelInboundHandler;
import org.example.Command.FileMessage;
import org.example.Constant;

import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

import static org.example.Constant.clientDirectory;

public class RecvCommandClientHandler extends SimpleChannelInboundHandler<FileMessage> implements SaveFile{
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, FileMessage msg) throws Exception {
        SaveFile.saveFile(msg, clientDirectory);
    }
}
